package pers.zc.activiti.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import pers.zc.activiti.thread.TestThread;

/**
 * @Annotion:
 * @ClassName: TestThread
 * @Author: Lin Fuyuan
 * @Date: 2019/9/26  10:34
 * @Version: 1.0
 */
@Controller
@RequestMapping("/Thread")
public class TestThreadController {
   private  static boolean  runing = true;
   private volatile static String name = null;
   static int n = 1;
   @GetMapping("start")
   public  void test() {
       TestThread testThread = new TestThread();
       testThread.run();
       name = TestThread.name;


   }

    @GetMapping("stop")
    public void stop() throws InterruptedException {
       Thread thread = new Thread(name);
        thread.wait();
//        TestThread.running = false;
        System.out.println("stop!");

    }

    @GetMapping("restart")
    public void restart(){
       TestThread testThread = new TestThread();
       testThread.notifyAll();
        System.out.println("restart!");

    }

}
